package com.ruoyi.project.cms.knowledge.service;

import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.common.utils.text.Convert;
import com.ruoyi.project.cms.knowledge.domain.Project;
import com.ruoyi.project.cms.knowledge.mapper.ProjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 公司:sxt
 * 作者: MR.Z
 * 类名: ProjectServiceImpl
 * 描述:
 * 时间: 2020-05-19
 */

@Service
public class ProjectServiceImpl implements ProjectService {

    @Autowired
    private ProjectMapper projectMapper;

    @Override
    public List<Project> findMore(Project project) {
        return projectMapper.selectMore(project);
    }

    @Override
    public int add(Project project) {
        return projectMapper.insert(project);
    }

   /* @Override
    public String checkProjectNameUnique(String panme) {
        Project p1 = projectMapper.checkProjectName(panme);
        if(p1!=null){
            return UserConstants.PROJECT_NAME_NOT_UNIQUE;
        }
        return UserConstants.PROJECT_NAME_UNIQUE;
    }*/

    @Override
    public Project selectById(String pid) {
        return projectMapper.selectById(pid);
    }

    @Override
    public String selectTBP(String pid) {
        return projectMapper.seletTBP(pid);
    }

    @Override
    public int updateProject(Project project) {
        return projectMapper.updateProject(project);
    }

    @Override
    public int deleteProjectByIds(String ids) {
        return projectMapper.deleteProjectByIds(Convert.toStrArray(ids));
    }
}
